package com.sqfw.common.enums.knowledge;

import lombok.Getter;

/**
 * 搜索类型
 * KL_TITLE--标题
 * KL_CONTENT--知识内容
 * KL_KEYWORD--关键字
 * */
public enum KlContentSearchTypeEnum {

    KL_TITLE("KL_TITLE", "标题"),
    KL_CONTENT("KL_CONTENT", "知识内容"),
    KL_KEYWORD("KL_KEYWORD", "关键字"),
    ;

    @Getter
    private String key;
    @Getter
    private String desc;

    KlContentSearchTypeEnum(String key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    /**
     * 根据key，查询描述
     * */
    public static KlContentSearchTypeEnum by(String key) {
        KlContentSearchTypeEnum[] enums = KlContentSearchTypeEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (key.equals(enums[i].key) ) {
                return enums[i];
            }
        }
        return null;
    }

}
